package test;
import java.util.*;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lishuo
 * Date: 2023-07-25
 * Time: 20:42
 */
class Integercmp implements Comparator<Integer>{
    @Override
    public int compare(Integer o1, Integer o2) {
        return o2.compareTo(o1);
    }
}

public class Demo {

    public static void main1(String[] args) {
        Integercmp cmp = new Integercmp();
        Queue<Integer> maxHeap = new PriorityQueue<>(cmp);
    }

    public static void main2(String[] args) {
        Queue<Integer> maxHeap = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2.compareTo(o1);
            }
        });
    }

    public static void main3(String[] args) {
        Queue<Integer> maxHeap = new PriorityQueue<>((o1,o2)->{
            return o2.compareTo(o1);
        });
    }
}
